#ifndef HTTPDATABASECLIENTSTORE_H
#define HTTPDATABASECLIENTSTORE_H

#include <QMap>
#include <QObject>
#include <QSharedPointer>

class HttpDatabaseClient;

class HttpDatabaseClientStore : public QObject
{
    Q_OBJECT
public:
    static QSharedPointer<HttpDatabaseClient> databaseClient (QString hostName, quint16 port);

private slots:
    static void removeDatabaseClient (QObject* databaseClientObject);

private:
    class DatabaseClientData
    {
    public:
        DatabaseClientData (QString m_hostName, quint16 m_port);
        DatabaseClientData();
        bool operator <(const DatabaseClientData& other) const;

    private:
        QString m_hostName;
        quint16 m_port;
    };

    static QMap<DatabaseClientData,QWeakPointer<HttpDatabaseClient>> m_databaseClients;
    static QMap<QObject*,DatabaseClientData> m_databaseClientObjects;
};

#endif // HTTPDATABASECLIENTSTORE_H
